package com.qf.entity;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@Data
@Accessors(chain = true)
public class User implements Serializable {

    private Integer id;
    private String username;
    private String password;
    private String name;
    private Integer age;
    private Date birthday;
    private List<String> powers;

    /**
     * 返回一个权限的字符串 1-2-3
     * @return
     */
    public String getPowerStr(){
        List<String> powers = this.getPowers();
        String powerStr = "";
        for (String power : powers) {
            if (powerStr.length() != 0) powerStr += "-";
            powerStr += power;
        }
        return powerStr;
    }
}
